#ifndef ELFMEMORYIMAGE_H
#define ELFMEMORYIMAGE_H

#include "crossbit/common.h"
#include "crossbit/MemoryImage.h"

//////Begin////////////////////////Added by Gujh for RaceBit///////////////////////////////////
#include <elf.h>
//////End//////////////////////////Added by Gujh for RaceBit///////////////////////////////////


namespace crossbit {

				class ELFMemoryImage: public MemoryImage {
								public:

												ELFMemoryImage(	XTPStr pathname, 
																				XTUint32 argc, 
																				XTPStr argv[],
																				XTPStr envp[] );

												virtual ~ELFMemoryImage();

												// Load the ECOFF binary image into this Image
												virtual bool load();

												// Map the src address to target address
												virtual XTMemAddr map(XTMemAddr src);

//////Begin////////////////////////Added by Gujh for RaceBit///////////////////////////////////
												XTPStr	loadOneSection(XTInt32 file_offset, XTInt32 section_size);
												Elf32_Half	findSectionType(Elf32_Word section_type, Elf32_Shdr *section_header, Elf32_Half section_num, Elf32_Half start_index);
												XTMemAddr	lookupFuncSPC(XTPStr func_symbol_name);
												XTPStr lookupFuncName(XTMemAddr func_SPC);
//////End//////////////////////////Added by Gujh for RaceBit///////////////////////////////////

								protected:
												virtual XTMemAddr setupStack(XTMemAddr base);

												static const XTUint32 MAX_ENVIRON = 16384;

//////Begin////////////////////////Added by Gujh for RaceBit///////////////////////////////////
												XTInt32	string_table_size;
												XTPStr	string_table_header;
												XTInt32	symbol_table_elem_num;
												Elf32_Sym	*symbol_table_header;
//////End//////////////////////////Added by Gujh for RaceBit///////////////////////////////////
			};
}

#endif	//ELFMEMORYIMAGE_H

